<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>对象的劫持</title>
</head>
<body>
    

    <script>
        
        let obj = {
            name: 'ws'
        };

        Object.defineProperty(obj,'name',{
            get () {
                return 'get ll'
            },
            set (newVal) {
                console.log('changed');
            }
        });

        console.log(obj.name);
        obj.name = 'wwww';
        console.log(obj.name);
    
    </script>

</body>
</html>